package java_collection.set;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;

public class HashSetNoDups {

	public static void main(String[] args) {
		
		Collection<Integer> c = new ArrayList<>();
		c.add(1);
		c.add(1); // duplicate
		c.add(2);
		c.add(3);
		
		// eliminate duplicates
		Collection<Integer> noDups = new HashSet<>(c);
		print(noDups);

	}
	static void print(Collection<Integer> collection){
		for(Integer c: collection){
			System.out.println(c);
		}
	}
}
